home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form DBComboTest
- Caption = "DBCombo Replacment"
- ClientHeight = 4140
- ClientLeft = 645
- ClientTop = 1545
- ClientWidth = 5910
- Height = 4545
- Left = 585
- LinkTopic = "Form1"
- ScaleHeight = 4140
- ScaleWidth = 5910
- Top = 1200
- Width = 6030
- Begin VB.CommandButton Command1
- Caption = "Close"
- Height = 735
- Left = 1800
- TabIndex = 3
- Top = 3120
- Width = 2295
- End
- Begin VB.ComboBox Combo1
- Height = 315
- Index = 1
- Left = 360
- TabIndex = 2
- Top = 1320
- Width = 5295
- End
- Begin VB.ListBox List1
- Height = 1230
- Left = 360
- TabIndex = 1
- Top = 1680
- Width = 5295
- End
- Begin VB.ComboBox Combo1
- Height = 315
- Index = 0
- Left = 360
- TabIndex = 0
- Top = 480
- Width = 5295
- End
- Begin VB.Label Label2
- Caption = "Titles"
- Height = 255
- Left = 360
- TabIndex = 5
- Top = 1080
- Width = 615
- End
- Begin VB.Label Label1
- Caption = "Publishers"
- Height = 255
- Left = 360
- TabIndex = 4
- Top = 240
- Width = 1335
- End
- Attribute VB_Name = "DBComboTest"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Combo1_Change(Index As Integer)
- End Sub
- Private Sub Command1_Click()
- End Sub
- Private Sub Form_Load()
- 'See Declaration section of the Class module for comments.
- Dim DB As Database
- Dim RS As Recordset
- Dim DbPath As String, i As Integer
- Dim CnrtFill As ControlFill
- Set CnrtFill = New ControlFill
- DbPath = "G:\VB32\BIBLIO.MDB"
- Set DB = OpenDatabase(DbPath)
- For i = 0 To 2
- Select Case i
- Case 0
- Set RS = DB.OpenRecordset("Publishers", dbOpenSnapshot)
- CnrtFill.SourceField = "Company Name"
- CnrtFill.SourceControl = Combo1(i)
- Case 1
- Set RS = DB.OpenRecordset("Titles", dbOpenSnapshot)
- CnrtFill.SourceField = "Title"
- CnrtFill.SourceControl = Combo1(i)
- Case 2
- ' You Could set the listbox to a different recordset, but for this demo
- ' I'm filling with the last recordset.
- CnrtFill.SourceControl = List1
- Set RS = DB.OpenRecordset("Titles", dbOpenSnapshot)
- CnrtFill.SourceField = "Title"
- End Select
- CnrtFill.SourceRS = RS
- If CnrtFill.FillControl = False Then
- MsgBox "Invalid Control Reference"
- End If
- Next i
- End Sub
-